package com.heima.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.heima.anno.State;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.groups.Default;
import java.time.LocalDateTime;
import java.io.Serializable;

/**
 * (Article)实体类
 *
 * @author makejava
 * @since 2024-09-29 15:45:00
 */
public class Article implements Serializable {
    private static final long serialVersionUID = 266023539597213330L;
/**
     * ID
     */
    @NotNull(groups = Update.class)
    private Object id;
/**
     * 文章标题
     */
    @NotEmpty
    @Pattern(regexp = "^\\S{1,10}$")
    private String title;
/**
     * 文章内容
     */
    @NotEmpty
    private String content;
/**
     * 文章封面
     */
    @NotEmpty
    @URL
    private String coverImg;
/**
     * 文章状态: 只能是[已发布] 或者 [草稿]
     */
    @State
    private String state;
/**
     * 文章分类ID
     */
    @NotNull
    private Object categoryId;
/**
     * 创建人ID
     */
    private Object createUser;
/**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
/**
     * 修改时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    public interface Add extends Default{

    }

    public interface Update extends Default{

    }


    public Object getId() {
        return id;
    }

    public void setId(Object id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getCoverImg() {
        return coverImg;
    }

    public void setCoverImg(String coverImg) {
        this.coverImg = coverImg;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public Object getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Object categoryId) {
        this.categoryId = categoryId;
    }

    public Object getCreateUser() {
        return createUser;
    }

    public void setCreateUser(Object createUser) {
        this.createUser = createUser;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

}

